// 笔试强训2025/3/10
// 数字统计

#include <iostream>
using namespace std;

int main() {
    int left, right, count = 0;
    cin >> left >> right;
    while(left <= right)
    {
        int tmp = left;
        while(tmp)
        {
            if(tmp % 10 == 2) count++;
            tmp /= 10;
        }
        left++;
    }
    cout << count << endl;
    return 0;
}
// 64 位输出请用 printf("%lld")